import {
	mapGetters,
	mapState
} from 'vuex'
export default {
	data() {
		return {

		};
	},
	computed: {
		...mapGetters('m_cart', ['total']),
		...mapState('m_cart', ['cart'])
	},
	onShow() {
		this.setBadge();
	},
	methods: {
		setBadge() {
			uni.setTabBarBadge({
				index: 2,
				text: this.total + ''
			})
		},
	},
	watch: {
		cart: {
			handler: function(newVal) {
				this.setBadge()
			},
			deep: true
		}
	}
}
